<?php

class DisplayUI {

    public function displayInv($array) {

        echo "<table><thead><th>Name</th><th>Qty</th></thead>";

        while($row = mysql_fetch_array($array))
        {
            //echo "<tr><td>" . $row['item_id'] . "</td><td>" . $row['item_name'] . " </td><td> " . $row['item_qty'] . "</tr>";
            echo "<tr><td>" . $row['item_name'] . " </td><td> " . $row['item_qty'] . "</tr>";
        }

        echo "</table>";
    }

    public function displayAddItemForm() {
        echo  "<form method=\"post\" action=\"?section=inventory&action=submit\">"
            . "<label for=\"item_name\">Item Name:</label>"
            . "<input type=\"text\" name=\"item_name\" id=\"item_name\" /><br />"
            . "<label for=\"item_qty\">Qty:</label>"
            . "<input type=\"text\" name=\"item_qty\" id=\"item_qty\" /><br />"
            . "<input type=\"submit\"  value=\"Submit\" />"
            . "<input type=\"reset\" value=\"Reset\" />"
            . "</form>";
    }
	
	public function displayEditInv($array,$mod) {

        echo "<table><thead><th>Name</th><th>Qty</th><th>Edit</th></thead>";

        while($row = mysql_fetch_array($array))
        {
           // echo "<tr><td>" . $row['item_id'] . "</td><td>" . $row['item_name'] . " </td><td> " . $row['item_qty'] ; 
			echo "<tr><td>" . $row['item_name'] . " </td><td> " . $row['item_qty'] ; 
			echo "<td><a href=\"?section=inventory&action=edit&itemId=" . $row['item_id'] . "\">?</a></td>";
			echo "</tr>";
            
        }

        echo "</table>";
    }
	
	public function displayDeletionInv($array) {

        echo "<table><thead><th>Name</th><th>Qty</th><th>Delete</th></thead>";

        while($row = mysql_fetch_array($array))
        {
           // echo "<tr><td>" . $row['item_id'] . "</td><td>" . $row['item_name'] . " </td><td> " . $row['item_qty'] ; 
			echo "<tr><td>" . $row['item_name'] . " </td><td> " . $row['item_qty'] ; 
			echo "<td><a href=\"?section=inventory&action=delete&itemId=" . $row['item_id'] . "\">X</a></td>";
			echo "</tr>";
            
        }

        echo "</table>";
    }
}

?>
